import java.util.Arrays;

public class Solution2 {
    //轮转数组
    public static int[] rotate(int[] nums,int k) {
        int[] val = new int[nums.length];
        for (int i = 0; i < k; i++) {
            int j = nums.length-k+i;
            val[i] = nums[j];
        }
        for (int i = k; i < nums.length; i++) {
            int j = i-k;
            val[i] = nums[j];
        }
        return val;
    }
    public static void main(String[] args) {
        int[] nums = {1,2,3,4,5,6,7};
        int k = 3;
        int[] ret = rotate(nums, k);
    }
}
